/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package amd.core;

/**
 *
 * @author Latifah Dwi Nurachma
 */
import java.io.FileOutputStream;
import java.util.Properties;

public class PropertiesToXml {

    public static void writeProperties(String dbType, String dbUrl,
            String dbUserName, String dbPassword,
            String sourceFolder, String targetFolder,
            String textEditor, String pdfReader, float treshold) throws Exception{

        Properties properties = new Properties();
        properties.setProperty("database.type", dbType);
        properties.setProperty("database.url", dbUrl);
        properties.setProperty("database.username", dbUserName);
        properties.setProperty("database.password", dbPassword);
        properties.setProperty("folder.source", sourceFolder);
        properties.setProperty("folder.target", targetFolder);
        properties.setProperty("treshold", "" + treshold);
        properties.setProperty("program.texteditor", textEditor);
        properties.setProperty("program.pdfreader", pdfReader);

        FileOutputStream fos = new FileOutputStream("config.xml");
        properties.storeToXML(fos, "Configuration", "UTF-8");

    }

    public static void writeProperties() throws Exception{
        writeProperties("mysql", "jdbc:mysql://localhost:3306/db_amd_lsa",
                "root", "", "C:/AMD_LSA/source", "C:/AMD_LSA/target",
                "rundll32 url.dll,FileProtocolHandler",
                "rundll32 url.dll,FileProtocolHandler",0);
    }
}